package cn.ronghuanet.base.util;

import lombok.Data;
import org.springframework.expression.spel.ast.NullLiteral;

@Data
public class AjaxResult {
    private Boolean success;
    private String msg;
    private Object objData;

    public static AjaxResult success(){
        return  success(null);
    }

    public static AjaxResult success(Object data){
        AjaxResult ajaxResult = new AjaxResult();
        ajaxResult.setMsg("操作成功");
        ajaxResult.setSuccess(true);
        ajaxResult.setObjData(data);
        return ajaxResult;
    }


    public static AjaxResult error(){
        return error(null);
    }
    public static AjaxResult error(String msg){
        AjaxResult ajaxResult = new AjaxResult();
        ajaxResult.setMsg("操作失败:" + msg);
        ajaxResult.setSuccess(false);
        return ajaxResult;
    }
}
